package com.xuelang.pipeline.artifact.domain.resource.service.impl;

import com.xuelang.pipeline.artifact.client.common.result.PageRecord;
import com.xuelang.pipeline.artifact.client.resource.dto.ArtifactToolQuery;
import com.xuelang.pipeline.artifact.domain.resource.ArtifactTool;
import com.xuelang.pipeline.artifact.domain.resource.repository.ArtifactToolRepository;
import com.xuelang.pipeline.artifact.domain.resource.service.ArtifactToolDomainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 集群领域服务实现类
 *
 * @author xiwen.zxg
 * @since 2024/5/15
 */
@Service
public class ArtifactToolDomainServiceImpl implements ArtifactToolDomainService {

    @Autowired
    private ArtifactToolRepository artifactToolRepository;

    @Override
    public PageRecord<ArtifactTool> pageList(long currentPage, long pageSize, ArtifactToolQuery artifactToolQuery) {
        return artifactToolRepository.pageList(currentPage, pageSize, artifactToolQuery);
    }

    @Override
    public List<ArtifactTool> list(ArtifactToolQuery artifactToolQuery) {
        return artifactToolRepository.list(artifactToolQuery);
    }


    @Override
    public Boolean save(ArtifactTool artifactTool) {
        return artifactToolRepository.save(artifactTool);
    }

    @Override
    public Boolean update(ArtifactTool artifactTool) {
        return artifactToolRepository.update(artifactTool);
    }

    @Override
    public Boolean delete(String artifactToolUuid) {
        return artifactToolRepository.delete(artifactToolUuid);
    }

    @Override
    public ArtifactTool query(String artifactToolUuid) {
        return artifactToolRepository.query(artifactToolUuid);
    }

    @Override
    public Boolean existsArtifactCodeAndNameByProjectCode(String uuid, String projectCode, String artifactCode, String artifactName) {
        return artifactToolRepository.existsArtifactCodeAndNameByProjectCode(uuid, projectCode, artifactCode, artifactName);
    }

    @Override
    public ArtifactTool getArtifactToolByInstanceRepositoryName(String repositoryName) {
        return artifactToolRepository.getArtifactToolByInstanceRepositoryName(repositoryName);
    }

    @Override
    public List<ArtifactTool> listArtifactTool() {
        return artifactToolRepository.listArtifactTool();
    }

}
